package cn.hxsteel.storage.model.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.hxsteel.model.vo.PageVO;
import cn.hxsteel.storage.core.base.BaseDAO;
import cn.hxsteel.storage.model.po.CustomerPO;
import cn.hxsteel.storage.module.user.model.UserBO;

/**
 * 用户的数据访问对象
 */
@Repository
public class CustomerDAO extends BaseDAO< CustomerPO, Integer >
{
    /**
     * 按用户名称查询对象
     * 
     * @param username 用户名称
     */
    public CustomerPO selObjectByUsername( String username )
    {
	List< CustomerPO > customerPOs = find( "from CustomerPO as a where a.username = ?", username );
	if ( customerPOs == null ) { return null; }
	
	return customerPOs.get( 0 );
    }
    
    /**
     * 按UID查询对象
     * 
     * @param UID 用户UID
     */
    public List< CustomerPO > selObjectByUID( int uid )
    {
	return null;
	// return selProcList( "p_User_list", uid );
    }
    
    /**
     * 按ID查询对象
     * 
     * @param ID 用户ID
     */
    public CustomerPO selObjectByID( int id )
    {
	return null;
	// return selProcObj( "p_User_obj_sel_1", id );
    }
    
    /**
     * 按ID和用户名称查询对象
     * 
     * @param ID 用户ID
     */
    public CustomerPO selObjectByUsernameAndID( int id, String username )
    {
	return null;
	// return selProcObj( "p_User_obj_sel_2", id, username );
    }
    
    /**
     * 查询用户分页
     * 
     * @param page 页码
     * @param pageSize 每页记录数
     * @param uid 用户UID
     * @param username 用户名
     */
    public PageVO< UserBO > selPageByUsernameAndUID( int page, int pageSize, int uid, String username )
    {
	return null;
	// return (PageVO< UserBO >) selExProcPage( UserBO.class, "p_User_page", page, pageSize, uid, username );
    }
}